<template>
	<!-- components/tabChangeOrder/tabChangeOrder.wxml -->
	<view class="f-s-c pt30">
		<view :class="'flex p2 bf bs20 ' + (currentIndex == 0 ? 'changeActive' : '')" style="height: 70rpx"
			@tap="changeOrder" data-index="0">
			<image src="/static/image/index/qulickOrder.png" style="width: 58rpx; height: 58rpx"></image>
			<view class="ml10">
				<view class="f26 wei mb5">快速下单</view>
				<view class="f20 c9">免估价 更便捷</view>
			</view>
		</view>
		<view :class="'flex p2 bf bs20 ' + (currentIndex == 1 ? 'changeActive' : '')" style="height: 70rpx"
			@tap="changeOrder" data-index="1">
			<image src="/static/image/index/goosGet.png" style="width: 58rpx; height: 58rpx"></image>
			<view class="ml10">
				<view class="f26 wei mb5">靓机下单</view>
				<view class="f20 c9">多卖35%</view>
			</view>
		</view>
		<view :class="'flex p2 bf bs20 ' + (currentIndex == 2 ? 'changeActive' : '')" style="height: 70rpx"
			@tap="changeOrder" data-index="2">
			<image src="/static/image/index/goodsAdd.png" style="width: 58rpx; height: 58rpx"></image>
			<view class="ml10">
				<view class="f26 wei mb5">精准下单</view>
				<view class="f20 c9">回收价预测</view>
			</view>
		</view>
	</view>
</template>

<script>
	// components/tabChangeOrder/tabChangeOrder.js
	export default {
		data() {
			return {};
		},
		/**
		 * 组件的属性列表
		 */
		props: {
			pageType: {
				type: String,
				default: 'normalOrder' //快速下单 或 靓机下单   precision-精准下单
			},

			currentIndex: {
				type: [String, Number],
				default: '0' //点击索引值  0 1 表示快速/靓机下单  2表示精准下单
			}
		},
		mounted() {
			// 处理小程序 attached 生命周期
			this.attached();
		},
		/**
		 * 组件的方法列表
		 */
		methods: {
			attached() {},

			changeOrder(e) {
				let {
					index
				} = e.currentTarget.dataset;
				console.log("indexindexindex", index)
				if (this.pageType == 'normalOrder') {
					// 快速下单 或 靓机下单 来源入口
					if (index == 2) {
						// 跳到产品页
						uni.redirectTo({
							url: '/pages/classify/classify?pageSource=tabChangeOrder'
						});
						return;
					}
				} else {
					// 精准下单来源入口  跳回下单页面
					uni.redirectTo({
						url: '/pages/order/order?changeIndex=' + index
					});
				}
				uni.setNavigationBarTitle({
					title: index == 0 ? '快速下单' : index == 1 ? '靓机下单' : '精准下单'
				});
				this.$emit('myevent', {
					detail: index
				});
			}
		},
		created: function() {},
	};
</script>
<style>
	@import './tabChangeOrder.css';
</style>